package com.lxj.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.lxj.domain.BusRent;
import com.lxj.dto.BusRentDto;
import com.lxj.mapper.BusRentMapper;
import com.lxj.service.RentService;
import com.lxj.vo.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lxj
 * @date 2021/6/21 19:02
 * @Description:
 */
@Service
public class RentServiceImpl implements RentService {

    @Autowired
    private BusRentMapper mapper;

    /**
     * 分页查询
     * @param dto
     * @return
     */
    @Override
    public PageInfo<BusRent> findByPage(BusRentDto dto) {
        Page<BusRent> page = PageHelper.startPage(dto.getPage(),dto.getLimit());
        List<BusRent> busRents =  mapper.selectAll(dto);
        return new PageInfo<BusRent>(page.getTotal(),busRents);
    }
}
